package com.netdisk.service.impl;

import java.util.List;

import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import com.netdisk.dao.impl.LogDao;
import com.netdisk.entity.Log;

/**
 * 日志类
 * @author chenlong
 *2013-4-13
 */
@Service("logService")
public class LogService{
	
	private LogDao logDao;
	
	public LogDao getLogDao() {
		return logDao;
	}
	
	@Resource(name="logDao")
	public void setLogDao(LogDao logDao) {
		this.logDao = logDao;
	}

	public void save(Log log) {
		logDao.save(log);
	}
	
	public void update(Log log) {
		logDao.save(log);
	}

	/**
	 * 
	 * @param log 想要删除的log
	 * @param operateLog 操作删除的log, 所产生的log,需要持久化
	 */
	public void delete(Log log, Log operateLog) {
		logDao.delete(log);
		logDao.save(operateLog);
		
	}

	
	public List<Log> findAll() {
		return logDao.findAll();
	}

	
	public Log findById(String id) {
		return logDao.findById(id);
	}

	
	public List<Log> findByTop(int from, int max) {
		return logDao.findByTop(from, max);
	}
	
}
